package group.program.register.password;

import group.program.Controller.RegisterController;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.MockitoAnnotations;
import static org.junit.jupiter.api.Assertions.*;

class format {
    @InjectMocks
    private RegisterController registerController;

    @BeforeEach
    void setUp() {
        MockitoAnnotations.openMocks(this);
    }

    @Test
    void testValidatePasswordFormat1() {
        String validPassword = "abcdef";
        assertNull(registerController.validatePasswordFormat(validPassword));
    }
    @Test
    void testValidatePasswordFormat2() {
        String validPassword = "123456";
        assertNull(registerController.validatePasswordFormat(validPassword));
    }
    @Test
    void testValidatePasswordFormat3() {
        String validPassword = "abc123";
        assertNull(registerController.validatePasswordFormat(validPassword));
    }

    @Test
    void testInvalidPasswordFormat() {
        String invalidPassword = "abc_123";
        assertEquals("密码必须由数字或者英文字母组成", registerController.validatePasswordFormat(invalidPassword));
    }
}

